$percent1) { $tsize[1] = $percent0 * $imgHeight; } else { $tsize[0] = $percent1 * $imgWidth; } } else { if ($percent0 < $percent1) { $tsize[1] = $percent0 * $imgHeight; } else { $tsize[0] = $percent1 * $imgWidth; } } if (!isset($_GET["blocked"])) $img2 = imagecreatetruecolor ($tsize[0], $tsize[1]); imagecopyresampled($img2, $img, 0, 0, 0, 0, $tsize[0], $tsize[1], $imgWidth, $imgHeight); if (isset($filterarr)) { foreach($filterarr as $key => $value) { if ($filterarray[$key]["type"] == "yesno") { imagefilter($img2, constant($key)); } elseif ($filterarray[$key]["type"] == "number") { imagefilter($img2, constant($key), $value); } } } if (isset($_GET["rotate"]) && $_GET["rotate"] != 0) { $img2 = imagerotate($img2, $_GET["rotate"], 0); } $ctype = "image/jpeg"; } header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: $ctype"); header("Content-Transfer-Encoding: binary"); if (!isset($img2)) { $header="Content-Disposition: attachment; filename=".$filename.";"; header($header ); header("Content-Length: ".$len); $fh = fopen($file,"r"); if ($fh) { while (!feof($fh)) { echo fgets($fh,1024); } } } else { $header="Content-Disposition: attachment; filename=".$filename.".jpg;"; header($header ); imageJPEG($img2); } ?>